package com.iplant.basic.service;

import com.iplant.base.po.APIResult;
import com.iplant.base.po.ServiceResult;
import com.iplant.base.utils.general.Configuration;
import com.iplant.basic.service.basicenum.bpm.BPMEventModule;
import com.iplant.basic.service.po.bms.BMSEmployee;
import com.iplant.basic.service.po.bpm.BPMTaskBase;

public interface BPMService {
    String ServerUrl = Configuration.readConfigString("bpm.server.url", "config/config");

    String ServerName = Configuration.readConfigString("bpm.server.project.name", "config/config");

    /**
     * 创建流程实例
     *
     * @param wModule      模块
     * @param wBusinessKey 业务单ID
     * @param wData        提交数据
     */
    APIResult BPM_CreateProcess(BMSEmployee wLoginUser, BPMEventModule wModule, int wBusinessKey, Object wData);

    /**
     * 提交流程实例 返回数据有
     */
    APIResult BPM_CompleteTask(BMSEmployee wLoginUser, int wTaskID, int wLocalScope, Object wData);

    /**
     * 根据实例ID获取当前操作步骤
     */
    APIResult BPM_CurrentTask(BMSEmployee wLoginUser, int wProcessInstanceID);

    /**
     * 根据任务ID获取任务信息
     */
    APIResult BPM_GetTask(BMSEmployee wLoginUser, int wTaskID);

    /**
     * 根据任务ID获取可操作步骤
     */
    APIResult BPM_GetOperationByTaskID(BMSEmployee wLoginUser, int wTaskID);

    /**
     * 根据实例ID获取待办任务列表
     */
    APIResult BPM_GetTaskListByInstance(BMSEmployee wLoginUser, int wInstanceID);

    ServiceResult<Boolean> BPM_MsgUpdate(BMSEmployee wLoginUser, int wTaskID, int wLocalScope,
                                         BPMTaskBase paramBPMTaskBase, Object wData);

    ServiceResult<Integer> BPM_CreateToDoMessage(BMSEmployee wLoginUser, int wFlowID, int wTaskID,
                                                 int wModuleID, String wCode);

    APIResult BPM_GetInstanceByID(BMSEmployee wLoginUser, int wFlowID);

    APIResult BPM_DeleteInstanceByID(BMSEmployee wLoginUser, int wFlowID, String wReason);

    APIResult BPM_GetHistoryInstanceByID(BMSEmployee wLoginUser, int processInstanceId);

    APIResult BPM_GetActivitiHisTaskByPIId(BMSEmployee wLoginUser, int flowID);

    //region 指定驳回
    /**
     * 驳回到指定节点
     */
    APIResult BPM_RejectedSpecifiedActivity(BMSEmployee wLoginUser, String wTaskID, String targetActivityId,
                                            Object wData);
    ServiceResult<Object> BPM_RejectTo(BMSEmployee wLoginUser, String wTaskID, String targetActivityId, Object wData,
                                       String targetActivityName, int wFlowID);

    ServiceResult<Integer> BPM_SynchronizUser(BMSEmployee wLoginUser);
    //endregion
}
